home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 876 b | 45 lines | [TEXT/CWIE] |
- // ListTestView.cp
-
- #ifndef ListTestView_h
- #include "ListTestView.h"
- #endif
- #ifndef ForegroundColorMaintainer_h
- #include "ForegroundColorMaintainer.h"
- #endif
- #ifndef ViewMap_h
- #include "ViewMap.h"
- #endif
-
- ListTestView::ListTestView()
- : cell( 0 )
- {
- SetCellHeight( 2 );
- AddedCells( Range<uint32>( 0, 256 ) );
- }
-
- const ViewCell& ListTestView::operator[]( uint32 index ) const
- {
- const_cast<ColorCell&>(cell) = ColorCell( index );
- return cell;
- }
-
- ViewCell& ListTestView::operator[]( uint32 index )
- {
- cell = ColorCell( index );
- return cell;
- }
-
- ListTestView::ColorCell::ColorCell( uint32 index )
- {
- Assert( index < 256 );
- color.red = index * 0x101;
- color.green = index * 0x000;
- color.blue = index * 0x101;
- }
-
- void ListTestView::ColorCell::Draw( const ViewMap& map ) const
- {
- ForegroundColorMaintainer cm( color );
- PaintRect( &map.VisibleBounds() );
- }
-